package com.csun.cmny.provider.pojo;

import com.csun.cmny.provider.validator.UserValid;
import com.xiaoleilu.hutool.system.UserInfo;
import lombok.Data;
import org.hibernate.validator.constraints.NotEmpty;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Objects;

@Data
public class User implements Serializable {
    @NotNull(message = "{id.empty}", groups = { UserValid.class })
    private Long userid;

    private String username;

    @NotEmpty(message = "{User.name.notnull}", groups = { UserValid.class })
    @Size(min = 1, max = 32, message = "{User.name.length}", groups = { UserValid.class })
    private String realname;

    @NotEmpty(message = "{User.password.notnull}", groups = { UserValid.class })
    @Size(min = 1, max = 64, message = "{User.password.length}", groups = { UserValid.class })
    private String password;

    @NotEmpty(message = "{user.phone.empty}", groups = { UserValid.class })
    @Size(min = 1, max = 14, message = "{User.phone.length}", groups = { UserValid.class })
    private String phone;

    private Integer phonevalid;

    @NotNull(message = "{OldMan.sex.notnull}", groups = { UserValid.class })
    @Range(min = 0, max = 1, message = "{OldMan.sex.range}", groups = { UserValid.class })
    private Integer sex;

    @NotEmpty(message = "{User.shenfz.notnuull}", groups = { UserValid.class })
    @Size(min = 18, max = 18, message = "{User.shenfz.length}", groups = { UserValid.class })
    private String identityNumber;

    private Date birthday; 

    @NotNull(message = "{OldMan.wenhua.notnull}", groups = { UserValid.class })
    @Range(min = 1, max = 7, message = "{OldMan.wenhua.range.error}", groups = { UserValid.class })
    private Integer levelEducation;//文化程度 1 高中 2 大专 3本科 4 研究生 5 博士 6 小学 7 初中

    private Date inductionTime;

    @NotNull(message = "{User.touxiangid.notnull}", groups = { UserValid.class })
    private Integer headpicid;

    private Date lastdate;

    private Integer logincount;

    private Integer homeid;

    private Integer departmentid;

    private Long groupId;

    private Integer valid;

    private Date createtime;

    private Date modifytime;

    private Long modifier;
    
    private String name;	//护工组名称

    private List<Role> roles;

    private UserInfo userInfo;//用户信息

    private Department department;//部门
    
    private List<Room> roomList;//房间集合——护工护理日志房间分配

    private static final long serialVersionUID = 1L;

}